package io.github.qifan777.server.wallet.record.entity;

import io.github.qifan777.server.dict.model.DictConstants;
import io.github.qifan777.server.infrastructure.jimmer.BaseEntity;
import io.github.qifan777.server.wallet.root.entity.Wallet;
import io.qifan.infrastructure.generator.core.*;
import org.babyfish.jimmer.sql.DissociateAction;
import org.babyfish.jimmer.sql.Entity;
import org.babyfish.jimmer.sql.ManyToOne;
import org.babyfish.jimmer.sql.OnDissociate;

import java.math.BigDecimal;

@GenEntity
@Entity
public interface WalletRecord extends BaseEntity {
    @OnDissociate(DissociateAction.DELETE)
    @GenAssociationField(label = "钱包", order = 0, prop = "walletId")
    @ManyToOne
    Wallet wallet();

    @GenNumberField(label = "剩余金额", order = 1)
    BigDecimal balance();

    /**
     * 金额
     */
    @GenNumberField(label = "金额", order = 2)
    BigDecimal amount();

    /**
     * 类型如：提现，充值，奖励，返佣等等
     */
    @GenDictField(label = "类型", order = 2, dictEnName = DictConstants.WALLET_RECORD_TYPE)
    DictConstants.WalletRecordType type();

    /**
     * 描述信息
     */
    @GenTextField(label = "描述", order = 4)
    String description();
}
